import store from './Redux/store'
import React from 'react';
import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom'
import { Provider } from 'react-redux';
import Adminlogin from './Manage/Adminlogin';
import SystemManage from './Manage/SystemManage';
import CommunityManage from './Manage/CommunityManage';
import UserManage from './Manage/UserManage';
import FeedbackManage from './Manage/FeedbackManage';
import FruiterManage from './Manage/FruiterManage';
import DiscussManage from './Manage/DiscussManage';
import CommodityManage from './Manage/CommodityManage';
import Goods from './Manage/Goods';

const App = () => {
	return <Provider store={store}>
		<Router>
			<Switch>
				{/* <Route exact path='/' component={Adminlogin} /> */}
				<Route exact path='/systemmanage' component={SystemManage} />
				<Route path='/communitymanage' component={CommunityManage} />
				<Route path='/usermanage' component={UserManage} />
				<Route path='/feedbackmanage' component={FeedbackManage} />
				<Route path='/fruitermanage' component={FruiterManage} />
				<Route path='/discussmanage' component={DiscussManage} />
				<Route path='/commoditymanage' component={CommodityManage} />
				<Route path='/goods' component={Goods} />
				<Route component={Adminlogin} />
				<Route render={() => <Redirect to='/' />} />
			</Switch>
		</Router>
	</Provider>
}
export default App;








// //React官网首页
// import React from 'react';
// import {BrowserRouter as Router,Redirect,Route,NavLink,Switch} from 'react-router-dom'
// import Header from './pages/React/Header';
// import routes from './router.config';
// import RouteWithSubRoutes from './pages/React/RouteWithSubRoutes';
// //路由基本配置
// //路由传参（以及获取参数-props）
// //动态路由（/：pages）
// //js跳转
// //权限路由
// // npm i antd-mobile --registry https://
// //Router要在最外层最外层，Link,NavLink等等都要包在Router的里面
// const App = () => {
// 	return <Router>
// 		<Header />
// 		<Switch>
// 			{
// 				routes.map((route, i) => {
// 					return <RouteWithSubRoutes key={i} {...route} />
// 				})
// 			}
// 		</Switch>
// 	</Router>
// }
// export default App;




// const App = ()=>{
// 	return <Router>
// 		<Header />
// 		<Switch>
// 			{/* home组件这种配置方式会在Home组件的props内注入四个属性
//     		console.log(history);
// 			<Route exact path='/' component={Home} />
// 			<PrivateRoute path='/doc' component={Doc} />
// 			<Route exact path='/doc/:id' component={Doc} />
// 			<PrivateRoute path='/tuto' component={Tuto}/>
// 			<PrivateRoute path='/blog' component={Blog}/>
// 			<Route path='/comm' component={Comm}/>
// 			<Route path='/login' component={Login}/>
//       		no-match
//      		<Route component={()=><div>404</div>} />
//       		<Route path='*' component={()=><div>404</div>} /> */}
// 			  {
// 				//   routes.map(({pri,...rest})=>{
// 				// 	  if(pri){
// 				// 		  return <PrivateRoute {...rest} />
// 				// 	  }
// 				// 	  return <Route {...rest} />
// 				// 	})
// 				routes.map((route, i) => (<RouteWithSubRoutes key={i} {...route} />))
// 			  }
// 		</Switch>
// 	</Router>
// }





// //淘宝
// import React from 'react';
// import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom'
// import Home from './taobao/Home';
// import Cart from './taobao/Cart';
// import Order from './taobao/Order';
// import Mine from './taobao/Mine';
// import Search from './taobao/Search';
// import Goods from './taobao/Goods';
// import {Provider} from 'react-redux';
// import store from './taobao/store';
// import Login from './taobao/Login';
// const App = () => {
// 	return (
// 	<Provider store={store}>
// 		<Router>
// 			<Switch>
// 				{/* <Route exact path='/' component={Home} /> */}
// 				<Route path='/cart' component={Cart} />
// 				<Route path='/order' component={Order} />
// 				<Route path='/mine' component={Mine} />
// 				<Route path='/search' component={Search} />
// 				<Route path='/goods' component={Goods} />
// 				<Route path='/login' component={Login} />

// 				<Route component={Home} />
// 				<Route render={() => <Redirect to='/' />} />


// 			</Switch>
// 		</Router>
// 	</Provider>
// 	)
// }
// export default App;





//redux
//webpack
//umi
//Router(react-router)怎么实现的(源码)

//Redux-提供可预测的状态管理的容器
//解决跨层级传递属性的问题
//一般把Provider放到最外层，可以包着router
//action-是更新状态的唯一途径，就是一个普通的对象，一定包含一个type属性
//store-连接action和Reducer
/*
import store from './reduxDemo/store'
import React,{useState, useEffect} from 'react';
import {BrowserRouter as Router, Redirect, Route, NavLink, Switch} from 'react-router-dom'
import {Provider} from 'react-redux';
import Todos from './reduxDemo/Todos';
import Input from './reduxDemo/Input';
import Home from './reduxDemo/Home';


let obj = {user:'123'}
//Object.assign相当于拷贝一个对象（浅拷贝）
let obj1 = Object.assign({},obj,{user:456},{a:100})
console.log(obj === obj1);
console.log(obj,obj1);

const App = ()=>{
	// const [todos,setTodos] = useState(store.getState())
	// useEffect(()=>{
	// 	store.subscribe(()=>{
	// 		setTodos( store.getState() )
	// 	})
	// },[])
	// return <div>
			// 	{
	// 		todos.map((item)=><li>{item}</li>)
	// 	}
	// 	<button onClick={() => {
	// 		store.dispatch({
	// 			type:'add_todo',
	// 			value:'456'
	// 		})
	// 	}}>添加</button>
	// </div>


	return <Provider store={store}>
					<Router>
						<Home />
						<Input />
						<Todos />
					</Router>
				</Provider>
			}
export default App;

*/








// import React from 'react';
// import logo from './logo.svg';
// import './App.css';

// let ele =<h1 id="title">React111</h1>  //JSX语法，写起来像HTML
// console.log(ele);

// function App() {
//   return (
//     <div className="App">

//       {/*<header className="App-header">
//         <img src={logo} className="App-logo" alt="logo" />
//         <p>
//           Edit <code>src/App.js</code> and save to reload.
//         </p>
//         <a
//           className="App-link"
//           href="https://reactjs.org"
//           target="_blank"
//           rel="noopener noreferrer"
//         >
//           Learn React
//         </a>
//       </header> */}
//       <h1>React</h1>
//     <ul>{
//       [1,2,3,4,5].map((item)=><li>{item}</li>)
// }
//     </ul>
//     </div>
//   );
// }

// export default App;
